package main

import (
	"flag"
	"fmt"
	"github.com/labstack/echo"
	"github.com/labstack/echo/middleware"
	"net/http"
)

func main() {
	serverAddr := flag.String("addr", ":80", `serve listen on address, default : ":80"`)
	flag.Parse()
	serverCtx := echo.New()
	serverCtx.HideBanner = true
	serverCtx.Use(middleware.Gzip())
	serverCtx.GET("/", IfConfig)
	fmt.Printf("server exited with :%s", serverCtx.Start(*serverAddr))
}
func IfConfig(ctx echo.Context) error {
	realIp := ctx.RealIP()
	fmt.Printf("client ip is %s \n", realIp)
	return ctx.String(http.StatusOK, realIp)
}
